package websocket

import "net/http"

// 定义函数类型

type DailOptions func(option *dailOption)

type dailOption struct {
	pattern string      // 请求地址
	header  http.Header // 请求头
}

func newDailOptions(opts ...DailOptions) dailOption {
	o := dailOption{
		pattern: "/ws",
		header:  nil,
	}
	for _, opt := range opts {
		opt(&o)
	}
	return o
}

// 请求地址设置

func WithClientPatten(pattern string) DailOptions {
	return func(opt *dailOption) {
		opt.pattern = pattern
	}
}

// 请求头设置

func WithClientHeader(header http.Header) DailOptions {
	return func(opt *dailOption) {
		opt.header = header
	}
}
